#pragma once

#include "undomanager.h"

class UndoManager;

class Action
{
public:
	Action(){}
	/** destructor must be virtual so that different implementations can cleanup correctly */
	virtual ~Action(){}
	/** do the first time (automatically calls redo()) */
	virtual bool execute();
	/** the static name of this action type */
	static const char * GETNAME(){return "Action";}
	/** what to call this action */
	virtual const char * getName()const{return GETNAME();}
	/** @return if this action actually changed anything (should be put into history) */
	virtual bool isActualChange(){return true;}
	/** makes an exact copy of this action (using new) */
	virtual Action * clone()const{return 0;}

	/** can combine with another similar action into one event */
	virtual bool isCombinable(const Action & a_action)const{return false;}
	/** @return true if the given action's content was added to this action */
	virtual bool combine(const Action & a_action){return false;}

	/** do the action (potentially, do it again...) */
	virtual bool redo()const = 0;
	/** undo the action */
	virtual bool undo()const = 0;
};
